<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div class="widget-box">
	<div class="widget-header header-color-pink">
		<h5>
			<i class="icon-table"></i>用户列表
		</h5>
		<div class="widget-toolbar no-border">
			<button id="add" onclick="trans2('/system/user_create');" class="btn btn-xs bigger btn-yellow dropdown-toggle">
				<i class="icon-pencil"> 添加新用户</i>
			</button>
			<button id="refresh" onclick="trans2('/system/user');" class="btn btn-xs bigger btn-yellow dropdown-toggle">
				<i class="icon-refresh"> 刷新</i>
			</button>
		</div>
	</div>
	<div class="widget-body">
		<div class="widget-toolbox padding-2 clearfix">
			<form id="searchForm" class="form-inline" role="form">
				<div class="form-group">
					<input type="text" class="form-control" id="username" name="username" value="${username}" placeholder="登录名">
				</div>
				<div class="form-group">
					<input type="text" class="form-control" id="name" name="name" value="${name}" placeholder="姓名">
				</div>
				<button type="button" onclick="toPage(1)" class="btn btn-default  btn-sm">
					查询 <i class="icon-search icon-on-right bigger-110"></i>
				</button>
			</form>
		</div>
		<div class="widget-main no-padding">
			<table class="table table-striped table-bordered table-hover">
				<thead class="thin-border-bottom">
					<tr>
						<th class='center'><i class="icon-user"></i> 登录名</th>
						<th class='center'>姓名</th>
						<th class='center'>电话</th>
						<th class='center'>状态</th>
						<th class='center'>操作</th>
						<th class='center'>用户类型</th>
					</tr>
				</thead>

				<tbody>
					<c:forEach items="${pr.list}" var="user" varStatus="pageStatus">
						<tr>
							<td class='center'>${user.username}</td>
							<td class='center'>${user.name}</td>
							<td class='center'>${user.mobile}</td>
							<td class='center'><c:if test="${user.state eq 0}">
									<span class="label label-success">正常</span>
								</c:if> <c:if test="${user.state eq 1}">
									<span class="label label-danger">禁用</span>
								</c:if></td>
							<td class='center'><c:if test="${user.type==1}">管理员</c:if> <c:if test="${user.type==0}">普通用户</c:if></td>
							<td class='center'>
								<button onclick="trans2('/system/user_edit?id=${user.id}');" class="btn btn-xs btn-info tooltip-info" data-toggle="tooltip" data-placement="top" data-original-title="编辑">
									<i class="icon-edit bigger-110"></i> 编辑
								</button> <c:if test="${user.state eq 0 && user.type eq 0}">
									<button onclick="user_updateState(${user.id},1)" class="btn btn-xs btn-danger tooltip-info" data-toggle="tooltip" data-placement="top" data-original-title="禁用">
										<i class="icon-ban-circle bigger-110"></i> 禁用
								</c:if> <c:if test="${user.state eq 1}">
									<button onclick="user_updateState(${user.id},0)" class="btn btn-xs btn-success tooltip-info" data-toggle="tooltip" data-placement="top" data-original-title="启用">
										<i class="icon-ok bigger-110"></i> 启用
										<!-- <i class="icon-arrow-right icon-on-right"></i> -->
									</button>
								</c:if>

							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
</div>
<!-- 分页开始 -->
<input type="hidden" id="pageurl" value="${root}/system/user" />
<input type="hidden" id="pageform" value="searchForm" />
<jsp:include page="../page.jsp"></jsp:include>
<!-- 分页结束 -->
